import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/cdn_entity.dart';

CdnEntity $CdnEntityFromJson(Map<String, dynamic> json) {
  final CdnEntity cdnEntity = CdnEntity();
  final double? id = jsonConvert.convert<double>(json['id']);
  if (id != null) {
    cdnEntity.id = id;
  }
  final String? nameZh = jsonConvert.convert<String>(json['nameZh']);
  if (nameZh != null) {
    cdnEntity.nameZh = nameZh;
  }
  final String? nameEn = jsonConvert.convert<String>(json['nameEn']);
  if (nameEn != null) {
    cdnEntity.nameEn = nameEn;
  }
  final String? nameTha = jsonConvert.convert<String>(json['nameTha']);
  if (nameTha != null) {
    cdnEntity.nameTha = nameTha;
  }
  return cdnEntity;
}

Map<String, dynamic> $CdnEntityToJson(CdnEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nameZh'] = entity.nameZh;
  data['nameEn'] = entity.nameEn;
  data['nameTha'] = entity.nameTha;
  return data;
}

extension CdnEntityExt on CdnEntity {
  CdnEntity copyWith({
    double? id,
    String? nameZh,
    String? nameEn,
    String? nameTha,
  }) {
    return CdnEntity()
      ..id = id ?? this.id
      ..nameZh = nameZh ?? this.nameZh
      ..nameEn = nameEn ?? this.nameEn
      ..nameTha = nameTha ?? this.nameTha;
  }
}